public class test13 {
    public static void main(String[] args) {
        //定义原始数组
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        int[] Arr = CopyOfRange(arr,2 ,6);

        //遍历数组
        for (int i = 0; i < Arr.length; i++) {
            System.out.print(Arr[i] + " ");
        }
    }

    //实现拷贝数组
    public static int[] CopyOfRange(int[] arr,int from,int to){
         int[] Arr = new int[to - from];
         //伪造索引
        int index = 0;
        for (int i = from; i < to; i++) {
             Arr[index] = arr[i];
             index++;
        }
        return Arr;
    }
}
